#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define debug false

typedef struct
{
    int x1, y1, x2, y2;
}Troom;
Troom room[1000];    
int n;
long long ans;

bool in()
{
    int i;
    scanf("%d", &n);
    if (n==0) return false;
    for (i=0; i<n; ++i)
    {
        scanf("%d%d%d%d", &room[i].x1, &room[i].y1, &room[i].x2, &room[i].y2); 
        if (room[i].x1 > room[i].x2)
                swap(room[i].x1, room[i].x2);
        if (room[i].y1 > room[i].y2)
                swap(room[i].y1, room[i].y2);
    }
    if (debug)
    {
        printf("room list:\n");
        for (i=0; i<n; ++i)
           printf("%d %d %d %d\n", room[i].x1, room[i].y1, room[i].x2, room[i].y2);
    }        
}    
bool comp(Troom t1, Troom t2)
{
    return t1.x1 < t2.x1;
}    
inline void gettype(int a, int b, int &t1, int &t2, int &t3)
{
    if (room[a].y2==room[b].y1 && room[a].x2>room[b].x1-2) t1 = 1;
    else if (room[a].y1==room[b].y2 && room[a].x2>room[b].x1-2) t2 = 1;
    else if (room[a].x2==room[b].x1) t3 = 1;  
}    
int count_rect(int x, int y)
{
    int cnt = 0;
    while (x && y)  
        cnt += x--*y--;
    return cnt;
}    

// 如果返回负数则表示没有交集
inline int getoverlap(int x1, int y1, int x2, int y2)
{   
    return  (y1<y2?y1:y2) - ((x1>x2)?x1:x2);
}    


void deal()
{
    int t1, t2, t3, i, j, lap;
    sort(room, room+n, comp);
    ans = 0;
    for (i=0; i<n; ++i)
    {
        ans += count_rect(room[i].x2-room[i].x1, room[i].y2-room[i].y1);
        for (j=i+1; j<n; ++j)
        {
           t1 = t2 = t3 = 0;
           gettype(i, j , t1, t2, t3);
           if (t1 || t2)
           {
               lap = getoverlap(room[i].x1, room[i].x2, room[j].x1, room[j].x2);
               if (lap>2)
               {
                   lap -= 2;
                   ans += count_rect(lap, room[i].y2+room[j].y2-room[i].y1-room[j].y1);
                   ans -= count_rect(lap, room[i].y2-room[i].y1);
                   ans -= count_rect(lap, room[j].y2-room[j].y1);
               }    
           }    
           if (t3)
           {
               lap = getoverlap(room[i].y1, room[i].y2, room[j].y1, room[j].y2);
               if (lap>2)
               {
                   lap -= 2;
                   ans += count_rect(lap, room[i].x2+room[j].x2-room[i].x1-room[j].x1);
                   ans -= count_rect(lap, room[i].x2-room[i].x1);
                   ans -= count_rect(lap, room[j].x2-room[j].x1);
               }
           }    
        }// end of inner for - j    
    }   // end of outter for - i
    
}    

int main()
{
    int ncase=0;
    while (in())
    {
        deal();
        cout << "Case " << ++ncase << ": ";
        cout << ans << endl;
        
    }    
        
    
    return 0;    
}    